package com.demo.response;

import lombok.Data;

@Data
public class Resp<T> {
    private String code = "1";
    private T data;

    public static <T> Resp<T> ok(T data) {
        Resp<T> resp = new Resp<>();
        resp.setData(data);
        return resp;
    }
    public static <T> Resp<T> ok() {
        return new Resp<>();
    }
    public static <T> Resp<T> fail(T data) {
        Resp<T> resp = new Resp<>();
        resp.setData(data);
        resp.setCode("0");
        return resp;
    }
    public static <T> Resp<T> fail() {
        Resp<T> resp = new Resp<>();
        resp.setCode("0");
        return resp;
    }
}
